package com.jmb.api.common.enumPro;

/**
 * 请求方式枚举
 */
public enum CaseMethod {
    GET("get", 0),
    POST("post", 1),
    PATCH("patch", 2),
    PUT("put", 3),
    DELETE("delete", 4),
    HEAD("head", 5),
    OPTIONS("options", 6),
    TRACE("trace", 7);

    private final String methodName;
    private final Integer methodNum;

    public static Integer getMethodKey(String methodName) {
        for(CaseMethod caseMethod : CaseMethod.values()) {
            if (caseMethod.methodName.equalsIgnoreCase(methodName)) {
                return caseMethod.methodNum;
            }
        }
        return 0;
    }

    CaseMethod(String methodName, Integer methodNum) {
        this.methodName = methodName;
        this.methodNum = methodNum;
    }
}
